package ar.edu.unq.wannaplay.components;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.link.Link;

public class WPLink<T extends WebPage> extends Link<T>{
    private Class<T> goTo;
    private PageParameters parameters;

    private static final long serialVersionUID = 1L;

    public WPLink(final String id, final Class<T> page) {
        super(id);
        goTo = page;
        this.parameters = null;
    }
    
    public WPLink(final String id, final Class<T> page, PageParameters parameters) {
    	super(id);
    	this.goTo = page;
    	this.parameters = parameters;
    }

    @Override
    public void onClick() {
        this.setResponsePage(this.getGoTo(), this.getParameters());
    }

    // setters&getters
    private Class<T> getGoTo() {
        return goTo;
    }
    
    private PageParameters getParameters() {
		return parameters;
	}
}
